<?php

require_once '../ptnhuan-web1/libraries/utilites/functions.php';
$path =  "../ptnhuan-web1/data/films.txt";
$full_path = realpath($path);//realpath tráº£ vá» Ä‘Æ°á»ng dáº«n
$fimls = mreadFile($full_path);//Ä‘á»c file
?>
<form action="edit.php" method="post"> 
    <?php 
    foreach($fimls as $item){
     $filter=  trim($item,"\n\t\r ");
     $mang=  explode(";", $filter);
     if($_GET["if"]==$mang[0])
     {
         ?>
    <pre>
<img src='../ptnhuan-web1/public/images/films/<?php if (!empty($mang[1])) echo $mang[1]; ?>' algin="left"/><br>
Film name:  <input type="text" name="name" value="<?php if (!empty($mang[2])) echo $mang[2]; ?>"><br>
Rating   :  <input type="text" name="rating" value="<?php if (!empty($mang[3])) echo $mang[3]; ?>"><br>
Comment  :  <textarea name="comment" rows="5" cols="40"></textarea><br>
<input type="submit" name="submit" value="Save">
     <?php  }}?>
 </pre>
</form>
